package day0318.bigdecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;

/**
 * @Author Stringzhua
 * @Date 2024/3/18 17:53
 * description:
 */
public class demo02 {
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("123.45");
        //进行四舍五入操作
        System.out.println(bd1.setScale(1, RoundingMode.HALF_UP));
        //向下保留小数
        System.out.println(bd1.setScale(1, RoundingMode.HALF_DOWN));
    }
}
